/*
 * Package: org.grassfield.common.view
 * FileName: SignOutAction.java
 *  
 * Created by pandian on Jan 28, 2011
 */
package action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

/**
 * The Class SignOutAction.
 */
public class SignOutAction extends ActionSupport implements SessionAware {

	private static final long serialVersionUID = 1L;
	private Map<String, Object> session = null;
	
	/* (non-Javadoc)
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	@Override
	public String execute(){
		if (this.session.get("user$")!=null){
			this.session.remove("user$");
			super.addActionMessage("User successfully logged out");
		}else
		{
			super.addActionMessage("User session already invalidated");
		}
		return "SUCCESS";
	}

	@Override
	public void setSession(Map<String, Object> arg0) {
		this.session = arg0;
	}

}
